<%@ page trimDirectiveWhitespaces="true" %>
<%@page import="com.jason.imagesnode.MyStringUtil"%>
<%@page import="org.json.JSONObject"%>
<%@page import="java.util.UUID"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.util.List"%>
<%@ page contentType="text/html; charset=UTF-8"%>

<%@ page import="sun.misc.BASE64Decoder"%>
<%@ page import="java.io.FileOutputStream"%>
<%@ page import="java.io.File"%>

<%
	String sId = UUID.randomUUID().toString();
	
	response.setHeader("Access-Control-Allow-Origin","*");

	JSONObject obj = new JSONObject();
	obj.put("result", "Y");
	boolean flag = true;
	try {
		request.setCharacterEncoding("UTF-8");
		
		String filename = (String)request.getParameter("filename");// 服务器前缀
		
		// 不为空
		if(!MyStringUtil.isBlank(filename)){
			String basePath = getServletContext().getRealPath("/");
			
			String[] files = filename.split(",");
			
			for(int i = 0; i < files.length; ++i){
				
				String fl = files[i];
				
				if(!MyStringUtil.isBlank(fl)){
					try{
						String filepath = MyStringUtil.getFilePath(fl) + "/" + fl;
						File f = new File(basePath + filepath);
						
						f.delete();// 删除指定文件
					}catch(Exception e){
						e.printStackTrace();
					}
				}
			}
		}
		
	} catch (Exception e) {
		obj.put("errMsg", e);
		obj.put("result", "N");
		e.printStackTrace();
	} finally {
		try {
			
		} catch (Exception e) {
		}
		//out.println("Access-Control-Allow-Origin:*\r\n");
		out.println(obj.toString());
	}
%>